package com.lm.upms.user.controller;

import com.baomidou.mybatisplus.core.toolkit.BeanUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.lm.common.result.Result;
import com.lm.common.utils.BeanUtil;
import com.lm.upms.user.entity.SysUser;
import com.lm.upms.user.service.SysUserService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author xus
 * @since 2022-04-20
 */
@RestController
@AllArgsConstructor
@RequestMapping("/user")
public class SysUserController {

    private SysUserService userService;

    @GetMapping("/getUserByName")
    public Result<Map<String,Object>> getUserByName(@RequestParam String username) {
        SysUser user = userService.getUserByName(username);
        Map<String, Object> map = BeanUtil.object2Map(user);
        return Result.success(map);
    }
}

